package freshmanspecial.mredrock.com.welcomefreshman.Fragment;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import java.util.ArrayList;
import java.util.List;

import freshmanspecial.mredrock.com.welcomefreshman.Adapter.MyPagerAdapter;
import freshmanspecial.mredrock.com.welcomefreshman.Base.BaseFragment;
import freshmanspecial.mredrock.com.welcomefreshman.R;

/**
 * Created by Administrator on 2017/8/6 0006.
 */

public class MienOrgFragment extends BaseFragment {
   private MyPagerAdapter adapter;
    private TabLayout tabLayout;
    private ViewPager viewPager;
    private List<Fragment> list;
    private String[] titles = {"团委部门","红岩网校","校学生会","科联","社联","校青协","大艺团"};

    @Override
    protected void addDefaultData() {

    }

    @Override
    protected void initView() {
        list = new ArrayList<>();
        list.add(new MienOrgDetailFragment("团委部门"));
        list.add(new MienOrgDetailFragment("红岩网校"));
        list.add(new MienOrgDetailFragment("校学生会"));
        list.add(new MienOrgDetailFragment("科联"));
        list.add(new MienOrgDetailFragment("社联"));
        list.add(new MienOrgDetailFragment("校青协"));
        list.add(new MienOrgDetailFragment("大艺团"));
        tabLayout = $(R.id.org_tab);
        viewPager = $(R.id.org_pager);
        tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
        adapter = new MyPagerAdapter(getChildFragmentManager());
        adapter.setTitles(titles);
        adapter.setFragments(list);
        viewPager.setAdapter(adapter);
        tabLayout.setupWithViewPager(viewPager);
    }

    @Override
    protected int getResourceId() {
        return R.layout.special_2017_mien_org_fragment;
    }
}
